package com.ruoyi.basic.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.basic.domain.Allclass;
import com.ruoyi.basic.domain.Course;
import com.ruoyi.basic.mapper.AllclassMapper;
import com.ruoyi.basic.service.AllclassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("AllclassService")
public class AllclassServiceImpl implements AllclassService {
    @Autowired
    private AllclassMapper allclassMapper;
    @Value("${token.secret}")
    private String secret;

//    @Override
    public PageInfo find(Integer pageNum, Integer pageSize, Integer classCode, String className, String leader, String phone) {
        //分页插件
        PageHelper.startPage(pageNum,pageSize);
        Allclass allclass = new Allclass();
        allclass.setClassCode(classCode);
        allclass.setClassName(className);
        allclass.setLeader(leader);
        allclass.setPhone(phone);
        List<Allclass> classes = allclassMapper.find(allclass);
//        //分页信息
        PageInfo pageInfo = new PageInfo(classes);
        return pageInfo;
    }

    @Override
    public PageInfo findStudent(Integer classCode) {
        List<Allclass> allclasses = allclassMapper.findStudent(classCode);
        //分页信息
        PageInfo pageInfo = new PageInfo(allclasses);
        return pageInfo;
    }
}
